package com.ning.ems.entity;

import com.ning.ems.enums.PackageState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Repository;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * Process state information of the package.
 *
 * @author Ning 242741154@qq.com
 * @date 2020/2/29 16:59
 */
@Data
@Repository
@ApiModel("Entity-PackageStateInfo")
public class PackageStateInfo implements Serializable {
    @ApiModelProperty("Primary key")
    private Integer id;

    @ApiModelProperty("package id")
    private Integer pkg;

    /**
     * Get it by invoke :
     * {@link java.time.LocalDateTime#now() LocalDateTime.now()}
     * <p>
     * !!! Assign at back end
     */
    @ApiModelProperty("processing time")
    private LocalDateTime date;

    @ApiModelProperty("courier id")
    private Integer courier;

    /**
     * Get the describe by invoke :
     * {@link PackageState#descOf(int)
     * PackageState.descOf(int)}
     * <p><p><p>
     * Describe of the transport process:
     * <pre>
     * if its state not equals transporting:
     *     "{PackageState.descOf(int)} 从 {senderAddr}，发往 {receiverAddr}";
     *     or "{PackageState.descOf(int)} 已到达 {receiverAddr}".
     * else:
     *     "已揽收 快递员{courier}已揽收"
     *     or "正在派送 快递员{courier}正在派送"
     *     or "已签收 您已签收"
     * </pre>
     */
    @ApiModelProperty("state")
    private Integer state;
}
